package grg.learn.compose.wanandroid.ui.foundations

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import grg.learn.compose.wanandroid.ui.theme.Theme
import grg.learn.compose.wanandroid.ui.theme.textStyle


/**
 * create by iso88591 at 2021/12/29
 * Text ====================================================================================
 */
@Composable
fun Theme.GText(
    text: String,
    modifier: Modifier = Modifier,
    style: TextStyle = textStyle.contentText,
    onTextLayout: (TextLayoutResult) -> Unit = {},
    overflow: TextOverflow = TextOverflow.Clip,
    softWrap: Boolean = true,
    maxLines: Int = Int.MAX_VALUE,
) {
    androidx.compose.foundation.text.BasicText(
        AnnotatedString(text),
        modifier,
        style,
        onTextLayout,
        overflow,
        softWrap,
        maxLines
    )
}